In [7]:
pow(2, 38)


Out[7]:
274877906944

In [20]:
from string import ascii_lowercase as al

# Build Caesar table using a shift of 2
table = str.maketrans(al, al[2:] + al[:2])

hint = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
print("Hint: \"%s\"\n" % hint.translate(table))

cypher_flag = 'map'
flag = cypher_flag.translate(table)
print(f'Flag: \"{flag}\"')


Hint: "i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url."

Flag: "ocr"

In [30]:
import requests
import re

webpage = requests.get('http://www.pythonchallenge.com/pc/def/ocr.html').text

# Filter comments
comments = re.findall(r'<!--([^>]*)-->', webpage)
cypher_flag = comments[1]  # Get second comment

# Guessed a "rare" character in a mess was something readable, so anything that is alphabetic
regex = re.findall(r'[a-z]', cypher_flag)
lc = ''.join([x for x in cypher_flag if x.isalpha()])
print('Using regex:', regex)
print('Using isalpha:', lc)


Using regex: ['e', 'q', 'u', 'a', 'l', 'i', 't', 'y']
Using isalpha: equality

In [34]:
import requests
import re

# Load website and comment
webpage = requests.get('http://www.pythonchallenge.com/pc/def/equality.html').text
cypher_flag = re.findall(r'<!--([^>]*)-->', webpage)[0]

# One letter surrounded by EXACTLY three big bodyguards on each of its side = 3 upper, 1 lower, 3 upper (EXACTLY)
matches = re.findall(r'[a-z][A-Z]{3}[a-z][A-Z]{3}[a-z]', cypher_flag)

''.join([x[4] for x in matches])


Out[34]:
'linkedlist'